{include file="public/header"/}

<div class="wrapper wrapper-content animated fadeInRight">
    <!-- Panel Other -->
    <div class="ibox float-e-margins">
        <div class="ibox-title">
            <h5>日志列表</h5>
        </div>
        <div class="ibox-content">

            <div class="hr-line-dashed"></div>

            <div class="example-wrap">
                <div class="example">
                    <table class="table table-bordered table-hover">
                        <thead>
                            <tr class="long-tr">
                                <th width="5%">ID</th>
                                <th width="5%">用户ID</th>
                                <th width="5%">操作用户</th>
                                <th width="15%">描述</th>
                                <th width="10%">地址</th>
                                <th width="10%">操作时间</th>
                                <th width="8%">操作</th>
                            </tr>
                        </thead>
                                                
                        <script id="list-template" type="text/html">
                            {{ for(var i=0; i< it.length; i++) { }}
                            <tr class="long-td">
                                <td>{{=it[i].log_id}}</td>
                                <td>{{=it[i].admin_id}}</td>
                                <td>{{=it[i].admin_name}}</td> 
                                <td>{{=it[i].description}}</td>  
                                <td>{{=it[i].ip}}</td> 
                                <td>{{=it[i].add_time}}</td> 
                                <td>
                                    <a href="javascript:;" onclick="del_log({{=it[i].log_id}})" class="btn btn-danger btn-xs">
                                        <i class="fa fa-trash-o"></i> 删除
                                    </a>
                                </td>                               
                            </tr>
                            {{ } }}
                        </script>
                        <tbody id="list-content"></tbody>
                    </table>
                    <div id="AjaxPage" style="text-align:right;"></div>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- End Panel Other -->
</div>

<!-- 加载动画 -->
<div class="spiner-example">
    <div class="sk-spinner sk-spinner-three-bounce">
        <div class="sk-bounce1"></div>
        <div class="sk-bounce2"></div>
        <div class="sk-bounce3"></div>
    </div>
</div>

{include file="public/footer" /}
<script src="__JS__/doT.min.js"></script>

<script type="text/javascript">
    Ajaxpage();
    function Ajaxpage(curr){
      
        $.getJSON('{:url("demo/dotjs")}', {page: curr || 1}, function(data){
            $(".spiner-example").css('display','none'); //数据加载完关闭动画 
            if(data==''){              
                $("#list-content").html('<td colspan="20" style="padding-top:10px;padding-bottom:10px;font-size:16px;text-align:center">暂无数据</td>');
            }else{

                var content_deal = document.getElementById('list-content');
                var tpl_deal = document.getElementById('list-template').text;
                var tempFn_deal = doT.template(tpl_deal);
                content_deal.innerHTML = tempFn_deal(data);

                laypage({
                    cont: $('#AjaxPage'),//容器。值支持id名、原生dom对象，jquery对象,
                    pages:'{$allpage}',//总页数
                    skip: true,//是否开启跳页
                    skin: '#1AB5B7',//分页组件颜色
                    curr: curr || 1,
                    groups: 3,//连续显示分页数
                    jump: function(obj, first){
                        if(!first){
                            Ajaxpage(obj.curr)
                        }
                        $('#allpage').html('第'+ obj.curr +'页，共'+ obj.pages +'页');
                    }
                });
            }
        });
    }

</script>
</body>
</html>